package com.ruoyi.zyx.api;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.ZyxDevice;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.zyx.domain.ZyxCost;
import com.ruoyi.zyx.domain.ZyxOrderBill;
import com.ruoyi.zyx.domain.ZyxSendorder;
import com.ruoyi.zyx.service.IZyxCostService;
import com.ruoyi.zyx.service.IZyxDeviceService;
import com.ruoyi.zyx.service.IZyxOrderBillService;
import com.ruoyi.zyx.service.IZyxSendorderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/zyxCostApi")
public class ZyxCostApi extends BaseController {
    @Autowired
    private IZyxCostService zyxCostService;
    @Autowired
    private IZyxSendorderService zyxSendorderService;
    @Autowired
    private IZyxDeviceService zyxDeviceService;
    /**
     * 回单信息保存
     * @param zyxCost
     * @return
     */
    @PostMapping("saveCostApi")
    public AjaxResult saveBillApi(@RequestBody ZyxCost zyxCost)
    {
        zyxCost.setCostdate(new Date());
        return toAjax(zyxCostService.insertZyxCost(zyxCost));
    }
    @GetMapping("/getZyxCostListApi")
    public TableDataInfo getZyxCostList(ZyxCost zyxCost)
    {
        List<ZyxCost> list = zyxCostService.selectZyxCostList(zyxCost);
        return getDataTable(list);
    }
    @DeleteMapping("/del/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(zyxCostService.deleteZyxCostById(id));
    }
}
